package com.wry.wry_test.AQS;

import java.util.concurrent.locks.LockSupport;

/**
 * @Author: wangrongyi
 * @Date: 2024/11/13 19:03
 * @Description:
 */
public class LockTest {

    static Object objectLock = new Object();
    public static void main(String[] args) {
        new Thread(() -> {
//            synchronized (objectLock){
            System.out.println(Thread.currentThread().getName()+"\t"+"------come in");
            try {
                objectLock.wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"\t"+"------被唤醒");
//            }
        },"A").start();
        new Thread(() -> {
//            synchronized (objectLock){
            objectLock.notify();
            System.out.println(Thread.currentThread().getName()+"\t"+"------通知");
//            }
        },"B").start();
    }
}
